Download
FAQ
History
HomeHomeNext API
Search
Feedback
Divider

Updating Web Modules

During development, you will often need to make changes to Web applications. After you have made the changes and want to run the modified application, you must:

  1. Recompile any modified classes.
  2. Repackage any modified components or resources.
  3. Redeploy the application.
  4. Reload the URL in the client.

To try this feature, first build and deploy the hello2 application. A sample hello2.war is provided in <INSTALL>/j2eetutorial14/examples/web/provided-wars/.

  1. In a terminal window, go to <INSTALL>/j2eetutorial14/examples/web/hello2/.
  2. Run asant build. The default target will copy the JSP pages to the <INSTALL>/j2eetutorial14/examples/web/hello2/build/ directory.
  3. Start deploytool.
  4. Create a Web application called hello2 by running the New Web Application Wizard. Select FileRight ArrowNewRight ArrowWeb Application WAR.
  5. New Web Application Wizard
    1. Select the Create New Stand-Alone WAR Module radio button.
    2. Click Browse and in the file chooser, navigate to <INSTALL>/j2eetutorial14/examples/web/hello2/.
    3. In the File Name field, enter hello2.
    4. Click Choose Module File.
    5. In the WAR Display Name field enter hello2.
    6. In the Context Root field, enter /hello2.
    7. Click Edit to add the content files.
    8. In the Edit Contents dialog, navigate to <INSTALL>/j2eetutorial14/examples/web/hello2/build/. Select duke.waving.gif, greeting.jsp, and response.jsp and click Add. Click OK.
    9. Click Next.
    10. Select the JSP radio button.
    11. Click Next.
    12. Select greeting.jsp from the Servlet Class combo box.
    13. Click Finish.
  6. Add an alias to the greeting Web component.
    1. Select the greeting Web component.
    2. Select the Aliases tab.
    3. Click Add to add a new mapping.
    4. Type /greeting in the aliases list.
  7. Select FileRight ArrowSave.
  8. Deploy the WAR.
  9. Open your browser to http://localhost:1024/hello2/greeting

Open the file <INSTALL>/j2eetutorial14/examples/web/hello2/greeting.jsp in an editor and change the greeting returned by greeting.jsp to be:

<h2>Hi, my name is Duke. What's yours?</h2> 

To update the Web application:

  1. Run asant build. This task copies the modified JSP page into the build directory.
  2. Select the hello2 WAR.
  3. Select ToolsRight ArrowUpdate. A popup dialog will display the modified file. Click OK.
  4. Select FileRight ArrowSave.
  5. Select ToolsRight ArrowDeploy. A popup dialog will query whether you want to redeploy. Click Yes.
  6. In the Deployment Managers dialog, enter the user name and password you specified when you installed the J2EE 1.4 Application Server.
  7. Click OK.
  8. A popup dialog will display the results of the deployment. Click Close.
  9. Reload the URL in the browser.

You should see the screen in Figure 3-3 in the browser:

New Greeting

Figure 3-3 New Greeting

Divider
Download
FAQ
History
HomeHomeNext API
Search
Feedback
Divider

All of the material in The J2EE 1.4 Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.